home *** CD-ROM | disk | FTP | other *** search
- class Germ extends smashing.Renderable
- {
- var update;
- var x;
- var y;
- var handler;
- var nSegment;
- var oData;
- var mcBuild;
- var sCrit;
- var a;
- var r = 15;
- var grabbable = true;
- var lowerLimit = 1.5;
- var variation = 1.5;
- var cNoise = 0;
- var initThrust = 300;
- var mx = 400;
- var my = 0;
- var bGot = false;
- function Germ()
- {
- super();
- this.update = this.updateRest;
- this.render = this.renderRest;
- }
- function updateRest(nElapsed)
- {
- }
- function updateRun(nElapsed)
- {
- this.my += smashing.Phys.gr * nElapsed;
- this.x += this.mx * nElapsed;
- this.y += this.my * nElapsed;
- }
- function updateFly(nElapsed)
- {
- this.x += this.mx * nElapsed;
- }
- function updateHide(nElapsed)
- {
- }
- function renderRest()
- {
- var _loc2_ = smashing.Viewport.getPos(this);
- this._x = _loc2_.x + smashing.Viewport.centerX;
- this._y = _loc2_.y + smashing.Viewport.centerY;
- }
- function renderRun()
- {
- var _loc2_ = smashing.Viewport.getPos(this);
- this._x = _loc2_.x + smashing.Viewport.centerX;
- this._y = _loc2_.y + smashing.Viewport.centerY;
- if(Math.abs(_loc2_.x) > smashing.Viewport.centerX + this._width)
- {
- this.handler.removeClip(this);
- }
- else if(Math.abs(_loc2_.y) > smashing.Viewport.centerY + this._height)
- {
- this.handler.removeClip(this);
- }
- }
- function react(oPlayer)
- {
- if(this.bGot == false)
- {
- switch(this.nSegment)
- {
- case 0:
- this.oData.sCritBot = null;
- break;
- case 1:
- this.oData.sCritMid = null;
- break;
- case 2:
- this.oData.sCritTop = null;
- }
- this.bGot = true;
- delete this.mcBuild.mcGerm;
- oPlayer.getGerm(this);
- this.my = - this.initThrust;
- switch(this.sCrit)
- {
- case "butterfly":
- case "macaw":
- this.update = this.updateFly;
- break;
- case "sloth":
- this.update = this.updateHide;
- break;
- default:
- this.update = this.updateRun;
- }
- this.render = this.renderRun;
- this.a.gotoAndStop("away");
- this.a.a.stop();
- }
- }
- function checkHit(oPlayer)
- {
- var _loc2_ = new smashing.Point(oPlayer.x - this.x,oPlayer.y - this.y);
- var _loc3_ = this.r + oPlayer.r;
- if(_loc2_.dot(_loc2_) < _loc3_ * _loc3_)
- {
- return true;
- }
- return false;
- }
- function setCritter(cr)
- {
- this.gotoAndStop(cr);
- this.sCrit = cr;
- _global.mcRoot.mcMenu.setFlash(cr);
- }
- }
-